import http from "./http"

/**
 * 
 * @returns nav 商品分类
 */
export function nav(){
    return http.get("/api/item/p/queryNav");
}

/**
 * 
 * @returns listNav 全部商品分类
 */
export function listNav(){
    return http.get("/api/item/p/queryLineNav");
}

/**
 * 
 * @returns carousel 轮播图
 */
export function carousel(){
    return http.post("/api/baseConsumer/p/index/queryBanner");
}

/**
 * 
 * @returns 今日推荐
 */
export function recommend(){
    return http.get("api/item/p/queryTodayRecommend");
}

/**
 * 
 * @returns 即将开售
 */
export function sell(){
    return http.get("api/item/p/queryToSaleItem");
}

/**
 * 
 * @returns 楼层信息
 */
export function floor(){
    return http.post("/api/item/p/queryFloorItems");
}

/**
 * 
 * @returns 分类热门演出
 */
export function seniority(itemTypeId){
    if(itemTypeId!=null)
        return http.get(`api/item/p/queryHotItems?itemTypeId=${itemTypeId}`);
    return http.get("api/item/p/queryHotItems");
}

/**
 * 
 * @returns 搜索条件信息-地区
 */
export function querycity(){
    return http.get("api/baseConsumer/p/queryCityList");
}

/**
 * 
 * @returns 搜索条件信息-分类
 */
export function sortgoods(param=0){
    return http.get("api/item/p/queryItemTypeByParent?parent="+param);
}

/**
 * 
 * @returns 猜你喜欢
 */
export function guesslike(itemTypeId=0){
    return http.post("api/list/guesslike",{itemTypeId});
}

/**
 * 
 * @returns 商品信息
 */
export function querygoodsinfos(param={}){
    return http.post("api/item/p/queryItemLike",param);
}

/**
 * 
 * @returns 商品详情
 */
export function getItems(id=null){
    // return http.post("api/desc/getItems",{id});
    return http.get(`api/item/p/queryItemDetail?id=${id}`)
}

/**
 * 
 * @returns 演出时间
 */
export function getTimePlan(itemId=null){
    return http.get(`/api/scheduler/p/queryItemScheduler?itemId=${itemId}`);
}

/**
 * 
 * @returns 门票价格
 */
export function getPrice(scheduleId=null){
    return http.get(`/api/scheduler/p/queryItemPrice?scheduleId=${scheduleId}`);
}

/**
 * 
 * @returns 评论
 */
export function getComments(param){
    return http.post("api/item/p/queryItemComment",param);
}

/**
 * 
 * @param {*} param 
 * @returns 添加评论
 */
export function commitItemComment(param){
    return http.post("api/item/v/commitItemComment",param);
}

/**
 * 
 * @returns 热门推荐
 */
export function getRecommend(itemTypeId=null){
    return http.get("api/item/p/queryItemRecommend",{itemTypeId});
}

/**
 * 
 * @returns 获取日程事件表
 */
export function getSchedule(scheduleId=0,cinemaId=0){
    return http.post(`api/scheduler/p/queryCinemaSeatArrayBySchedulerId`,{scheduleId,cinemaId});
}

/**
 * 
 * @returns 座位列表
 */
export function getSeatList(scheduleId=0){
    return http.get(`api/scheduler/p/queryOriginCinemaSeatSeatArray?scheduleId=${scheduleId}`);
}

/**
 * 
 * @returns 验证是否存在购票人
 */
export function validatebuyerexist(idCard){
    return http.post("api/order/validatebuyerexist",{idCard});
}

/**
 * 
 * @returns 添加购票人
 */
export function addticketbuyer(param){
    return http.post("api/order/addticketbuyer",param);
}

/**
 * 
 * @returns 获取购票人信息
 */
export function ticketbuyerlist(userId=undefined){
    return http.get("api/user/v/findByToken",{userId});
}

/**
 * 
 * @returns 提交订单
 */
export function submitorder(param){
    return http.post("api/scheduler/v/confirmOrder",param);
}

/**
 * 
 * @returns 查询订单
 */
export function confirmpay(orderNo=0){
    return http.get(`api/order/v/confirmpay?orderNo=${orderNo}`);
}

/**
 * 
 * @returns 微信支付
 */
export function wechatpay(orderNo){
    return http.post("api/pay/wechatpay",{orderNo});
}

/**
 * 
 * @returns 订单状态
 */
export function orderstate(orderNo=0){
    return http.post("api/pay/orderstate",{orderNo});
}

export  function postIndexCarousel(){
    return http.post('/api/index/carousel')
}
export function postMultipleGetGuessYouLike(){
    return http.post('api/multiple/getGuessYouLike')
}
export function postMultipleGetAdimgUrl(){
    return http.post('api/multiple/getAdimgUrl')
}
export function postMultipleGetParentChild(){
    return http.post('api/multiple/getParentChild')
}
export function postMultipleGetPopularSearch(){
    return http.post('api/multiple/getPopularSearch')
}


/**
 * 
 * @param {} phone 电话
 * @param {*} password 密码
 * @return 登录信息
 */
export function login(phone,password){
    return http.get(`api/user/p/login?phone=${phone}&password=${password}`)
}

/**
 * 
 * @returns token刷新
 */
export function refreshToken(){
    return http.get(`api/user/v/refreshToken`);
}

/**
 * 
 * @param {*} orderNo 
 * @returns 支付宝支付
 */
export function alipay(orderNo){
    return http.get(`api/pay/v/pagePay?orderNo=${orderNo}`);
}